package org.jeecg.modules.xl.order.service;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import org.apache.ibatis.annotations.Param;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.xl.h5api.vo.MyStoreDataVO;
import org.jeecg.modules.xl.h5api.vo.MyStoreVO;
import org.jeecg.modules.xl.order.dto.XlCustomerOrdeDTO;
import org.jeecg.modules.xl.order.dto.XlCustomerShipmentDTO;
import org.jeecg.modules.xl.order.entity.XlCustomerOrde;
import org.jeecg.modules.xl.order.entity.XlCustomerOrderDetail;
import org.jeecg.modules.xl.order.vo.OrderExport;
import org.jeecg.modules.xl.order.vo.OrderSheetDetail;
import org.jeecg.modules.xl.order.vo.XlCustomerOrdeCityVO;
import org.jeecg.modules.xl.order.vo.XlCustomerOrdeVO;
import org.jeecg.modules.xl.shopcart.entity.XlShopcart;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;
import java.util.Map;

/**
 * @Description: xl_customer_order
 * @Author: jeecg-boot
 * @Date:   2024-10-20
 * @Version: V1.0
 */
public interface IXlCustomerOrdeService extends IService<XlCustomerOrde> {

	/**
	 * 自定义查询订单
	 * @param wrapper
	 * @return
	 */
	Page<XlCustomerOrdeVO> queryList(Page<XlCustomerOrde> page, Wrapper<XlCustomerOrde> wrapper);

	/**
	 * 城配订单
	 * @param city
	 * @return
	 */
	List<XlCustomerOrdeCityVO> queryCityList( String city, String orderCode);;

	/**
	 * 添加一对多
	 *
	 * @param xlCustomerOrde
	 * @param xlCustomerOrderDetailList
	 */
	public void saveMain(XlCustomerOrde xlCustomerOrde,List<XlCustomerOrderDetail> xlCustomerOrderDetailList) ;

	/**
	 *
	 * @param xlCustomerOrde
	 * @param orderSheetDetailList
	 */
	public void saveOrderSheetMain(XlCustomerOrde xlCustomerOrde, List<OrderSheetDetail> orderSheetDetailList, String price_level);
	/**
	 * 修改一对多
	 *
   * @param xlCustomerOrde
   * @param xlCustomerOrderDetailList
	 */
	public void updateMain(XlCustomerOrde xlCustomerOrde,List<XlCustomerOrderDetail> xlCustomerOrderDetailList);
	
	/**
	 * 删除一对多
	 *
	 * @param id
	 */
	public void delMain (String id);
	
	/**
	 * 批量删除一对多
	 *
	 * @param idList
	 */
	public void delBatchMain (Collection<? extends Serializable> idList);

	/**
	 * 审核
	 * @param dto
	 */
    void audit(XlCustomerOrdeDTO dto);

	/**
	 * 付款
	 * @param dto
	 */
	void payment(XlCustomerOrdeDTO dto);

	/**
	 * 发货
	 * @param dto
	 */
	void shipment(XlCustomerShipmentDTO dto);

//	/**
//	 * 收货
//	 * @param dto
//	 */
//    void takeDelivery(XlCustomerOrdeDTO dto);

	/**
	 * 支付凭证
	 * @param dto
	 */
    void submitPayment(XlCustomerOrdeDTO dto);

	/**
	 * 订单提交
	 * @param dto
	 */
	Result<String> submit(XlCustomerOrdeDTO dto);

	Result<String> shouhuo(String orderids);

	/**
	 * 城配发货
	 * @param city
	 */
	void cityShipment(String city);


//	/**
//	 * 收货凭证
//	 * @param dto
//	 */
//	void submitTakeDelivery(XlCustomerOrdeDTO dto);


	List<OrderExport> exportOrderDetailS(QueryWrapper<OrderExport> queryWrapper);

	List<XlCustomerOrde> exportOnlyOrder(QueryWrapper<OrderExport> queryWrapper);

	void copyToCreate(XlCustomerOrdeDTO dto);

	Result<String> createKMOrder(String orderids)  ;

	Map<String,Map<String, Object>> selectOrdersAfterAmount(@Param("orders") String orders);


	List<MyStoreDataVO> getMyStoreData(String  stores);

	XlCustomerOrde submitOrder(String storeCode, List<XlShopcart> shopcarts, String orderNote);

    MyStoreVO getStoreUnpayAmount(String storeCode);

	List<Map> getCornerNum(String storeCode);

    XlCustomerOrde getOneByCode(String orderCode);

	List<XlCustomerOrderDetail> getDetailByCode(String orderCode);

    Result<String> createWDTOrder(String orderids);

    IPage<XlCustomerOrde> pageNew(Page<XlCustomerOrde> page, QueryWrapper<XlCustomerOrde> queryWrapper);


    List<Map> queryBrandOfOrderDetail(String brand, int month);

    String handleRefreshLogistics(String orderCode, String logiCode);
}
